/* GUI CONVERTED from rcrssup.p (converter v1.76) Thu Feb 28 19:34:10 2002 */
/* rcrssup.p - Customer Schedules Selective Required Schedule Update          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10.3.8 $                                                      */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.3    LAST MODIFIED: 10/13/92           BY: WUG *G462*          */
/* REVISION: 7.3    LAST MODIFIED: 03/01/93           BY: WUG *G761*          */
/* REVISION: 7.3    LAST MODIFIED: 03/22/95           BY: aed *G0J0*          */
/* REVISION: 8.5    LAST MODIFIED: 04/24/95           BY: dpm *J044*          */
/* REVISION: 7.4    LAST MODIFIED: 09/06/95           BY: bcm *G0TB*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 07/07/99   BY: *J3HR* Sachin Shinde      */
/* REVISION: 9.1      LAST MODIFIED: 09/10/99   BY: *N01B* Mugdha Tambe       */
/* REVISION: 9.1      LAST MODIFIED: 05/20/99   BY: *N004* Patrick Rowan      */
/* REVISION: 9.1      LAST MODIFIED: 12/08/99   BY: *N003* Dan Herman         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.10.3.8 $  BY: Jean Miller        DATE: 02/28/02  ECO: *N1BB*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* REQUIRED SCHEDULE SELECTIVE UPDATE */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

define new shared variable report_yn      like mfc_logical
   label "Report" initial yes.
/* DEFAULT VALUE FOR UPDATE_YN IS CHANGED FROM YES TO NO   */
/* SINCE, IT ITS RECOMMENDED APPROACH IN HELP DOCUMENTATION */
define new shared variable update_yn like mfc_logical
   label "Update" no-undo .

define new shared variable global_schtype as integer.
define new shared stream   audit.
define new shared variable audit_yn       like mfc_logical.
define new shared variable warn_ct        as integer no-undo.
define new shared variable week_offset    as integer.
define new shared variable using_seq_schedules
   like mfc_logical initial no no-undo.
define new shared variable ship-param1 as character no-undo.
define new shared variable ship-param2 as character no-undo.

define variable ship_rlse_id   like sch_rlse_id
   label "Ship Schedule Release ID".
define variable plan_rlse_id   like sch_rlse_id
   label "Plan Schedule Release ID".
define variable rcs_rlse_id    like sch_rlse_id
   label "Sequence Schedule Release ID".

define variable plan_schedule  as integer initial 1.
define variable ship_schedule  as integer initial 2.
define variable scx_recid      as recid no-undo.
define variable impexp         like mfc_logical no-undo.
define variable impexp_label   as character format "x(8)" no-undo.
define variable sequence_order like mfc_logical initial no no-undo.

/* VARIABLE DEFINITIONS FOR gpfile.i */
{gpfilev.i}

{rcordfrm.i}


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
{rcordfma.i}
   skip(1)
   ship_rlse_id         colon 35
   plan_rlse_id         colon 35
   rcs_rlse_id          colon 35
   skip(1)
   report_yn            colon 35
   update_yn            colon 35
with frame a attr-space width 80 side-labels NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

view frame a.

/* DETERMINE IF SEQUENCED SCHEDULES ARE INSTALLED */
{gpfile.i &file_name = """"rcf_ctrl""""}

if can-find (mfc_ctrl where
             mfc_field = "enable_sequence_schedules" and mfc_logical) and
             file_found
then
   using_seq_schedules = yes.

repeat:

   warn_ct = 0.

   /* GET SCHEDULED ORDER */
   /* ADDED PARAMETER THREE TO THE CALL: ANY NON-BLANK */
   /* VALUE ENABLES SITE SECURITY CHECK                */
   {rcgetord.i "old" " " "validate"}

   /* PROCESS SEQUENCE SCHEDULES WHEN:        */

   if using_seq_schedules and so_seq_order and so_inc_in_rss then
      sequence_order = yes.
   else
      sequence_order = no.

   assign
      ship-param1 = scx_shipfrom
      ship-param2 = scx_shipto.

   {gpbrparm.i &browse=rclu104.p &parm=c-brparm1 &val=scx_shipfrom}
   {gpbrparm.i &browse=rclu104.p &parm=c-brparm2 &val=scx_shipto}

   update
      ship_rlse_id
      plan_rlse_id
      rcs_rlse_id   when (sequence_order)
      report_yn
      update_yn
   with frame a
   editing:

      if frame-field = "ship_rlse_id" then do:
         global_schtype = ship_schedule.
         {gpbrparm.i &browse=gplu544.p &parm=c-brparm3
            &val="string(global_schtype)"}
         {mfnp05.i sch_mstr sch_tnlr
            "sch_type = ship_schedule and sch_nbr = sod_nbr
              and sch_line = sod_line"
            sch_rlse_id "input ship_rlse_id"}
         if recno <> ? then
            display sch_rlse @ ship_rlse_id with frame a.
      end.

      else
      if frame-field = "plan_rlse_id" then do:
         global_schtype = plan_schedule.
         {gpbrparm.i &browse=gplu544.p &parm=c-brparm3
            &val="string(global_schtype)"}
         {mfnp05.i sch_mstr sch_tnlr
            "sch_type = plan_schedule and sch_nbr = sod_nbr
              and sch_line = sod_line"
            sch_rlse_id "input plan_rlse_id"}
         if recno <> ? then
            display sch_rlse @ plan_rlse_id with frame a.
      end.

      else
      if frame-field = "rcs_rlse_id" then do:
         {mfnp05.i rcsd_det rcsd_index3
            "rcsd_order = sod_nbr and rcsd_line = sod_line"
            rcsd_rlse_id "input rcs_rlse_id"}
            if recno <> ? then
               display rcsd_rlse_id @ rcs_rlse_id with frame a.
      end.

      else do:
         status input.
         readkey.
         apply lastkey.
      end.

   end.    /* update */

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   scx_recid = recid(scx_ref).

   {gprun.i ""rcrssupa.p""
      "(input scx_recid,
        input rcs_rlse_id,
        input ship_rlse_id,
        input plan_rlse_id)"}

   {mftrl080.i}

   if warn_ct > 0 then do:
      {pxmsg.i &MSGNUM=8222 &ERRORLEVEL=2 &MSGARG1=warn_ct}
   end.

end.
